<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: zoud
  Date: 2016/10/14
  Time: 15:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Database Commons - Login</title>
</head>
<body>
<%--<div class="page-header" style="border-bottom: none">--%>
    <%--<h1 class="text-success text-center"><img src="${host}/static/img/dc-logo.png" height="70px" width="70px"/>--%>
        <%--Database Commons&nbsp;--%>
        <%--<small>a catalog of biological databases</small>--%>
        <%--<br>--%>
    <%--</h1>--%>
<%--</div>--%>
<div class="ui segment two column middle aligned stackable grid">
    <div class="column center aligned" style="padding: 50px">
        <h2 class="ui teal image header">
            <span class="content">
                Log-in to your account
            </span>
        </h2>
        <form class="ui large form" action="${host}/login" method="post">
            <p class="text-danger">
                ${SPRING_SECURITY_LAST_EXCEPTION.message}
            </p>
            <div class="field">
                <div class="ui left icon input">
                    <i class="mail icon"></i>
                    <input type="text" name="email" placeholder="E-mail address">
                </div>
            </div>
            <div class="field">
                <div class="ui left icon input">
                    <i class="lock icon"></i>
                    <input type="password" name="password" placeholder="Password">
                </div>
            </div>
            <button class="ui fluid large teal submit button" type="submit">Login</button>
            <div class="field">
                <div class="ui left input">
                    <label><a href="#" class="ui left">Forget password?</a></label>
                </div>
            </div>
        </form>
    </div>
    <%--<div class="ui vertical divider">OR</div>--%>
    <%--<div class="column" style="padding: 50px;">--%>
        <%--<h2 class="ui blue header"><span class="content">New to us? Please Sign up</span></h2>--%>
        <%--<form class="form-signin" role="form">--%>
            <%--<p class="text-warning text-left">--%>
                <%--Please enter your frequently used e-mail to register an account.--%>
            <%--</p>--%>
            <%--<div class="ui action input" style="width: 100%">--%>
                <%--<input type="text" name="email" placeholder="Email Address" id="email" required autofocus>--%>
                <%--<button class="ui button teal" data-loading-text="Loading..." type="button" id="signup">Submit</button>--%>
            <%--</div>--%>
            <%--<p class="text-danger" id="msg"></p>--%>
        <%--</form>--%>
    <%--</div>--%>
</div>
<script>
    $(document).ready(function () {
        $('#signup').click(function () {
            var email = $("#email").val();
            var $btn = $(this).button('loading');
            $.ajax({
                url: '${host}/register?email=' + email,
                type: 'get',
                success: function (data) {
                    $btn.button('reset');
                    $('#msg').html(data);
                }
            });
        });
    });
</script>
</body>
</html>
